# $Id$
# Maintainer: damir <damir@archlinux.org>

pkgname=dvd+rw-tools
pkgver=7.1
pkgrel=7
pkgdesc="dvd burning tools"
arch=('i686' 'x86_64')
license=('GPL')
url="http://fy.chalmers.se/~appro/linux/DVD+RW"
depends=('cdrkit' 'gcc-libs')
source=("http://fy.chalmers.se/~appro/linux/DVD+RW/tools/${pkgname}-${pkgver}.tar.gz"
        'dvd+rw-tools-7.0-dvddl.patch'
        'dvd+rw-tools-7.0-glibc2.6.90.patch'
        'dvd+rw-tools-7.0-wctomb.patch'
        'dvd+rw-tools-7.0-wexit.patch'
	'dvd+rw-tools-7.1-layerbreaksetup.patch')
sha1sums=('6400e013934ff589b4b224eced03fd9f42ed719b'
          'd2c949bc15420f39a9055757b1f5bb5543c46b6c'
          '6b2f496e8d95738501dcad5fb63a4faa32882202'
          '08ad4c2309ae1602b855cf1a2bbdbe0dab5037a2'
          'f50dc64f5d020f0dd64ffb38c18cfa3fbf03f8a2'
          'dd5224fdd8e94ec9483f651b3579cf9c18381129')

build() {
  cd "${srcdir}/${pkgname}-${pkgver}"
  # patches from Gentoo/Fedora
  # see https://bugs.gentoo.org/257360, https://bugzilla.redhat.com/show_bug.cgi?id=426068
  # and https://bugzilla.redhat.com/show_bug.cgi?id=243036
  patch -p0 -i "${srcdir}/dvd+rw-tools-7.0-dvddl.patch"
  patch -p1 -i "${srcdir}/dvd+rw-tools-7.0-glibc2.6.90.patch"
  patch -p0 -i "${srcdir}/dvd+rw-tools-7.0-wctomb.patch"
  patch -p1 -i "${srcdir}/dvd+rw-tools-7.0-wexit.patch"
  patch -p1 -i "${srcdir}/dvd+rw-tools-7.1-layerbreaksetup.patch"
  make
}

package() {
  cd "${srcdir}/${pkgname}-${pkgver}"
  install -m755 -d "${pkgdir}/usr/bin"
  install -m755 -d "${pkgdir}/usr/share/man/man1"

  install -m755 growisofs dvd+rw-booktype dvd+rw-format dvd+rw-mediainfo dvd-ram-control "${pkgdir}/usr/bin/"
  install -m644 growisofs.1 ${pkgdir}/usr/share/man/man1/growisofs.1
}
